﻿using System;
using System.Collections.Generic;

namespace Ayatta.Contract.Domain
{
    public class UserAddress : BaseEntity<int>
    {
        public int UserId { get; set; }
        public string Name { get; set; }
        public string Company { get; set; }
        public AddressCategory Category { get; set; }
        public int Country { get; set; }
        public string AreaId { get; set; }
        public string Province { get; set; }
        public string City { get; set; }
        public string District { get; set; }
        public string Address { get; set; }
        public string PostalCode { get; set; }
        public string Phone { get; set; }
        public string Mobile { get; set; }
        public bool IsDefault { get; set; }

        public static Func<string, IList<Area>, string> GetAreaName { get; set; }

        public override bool Equals(object obj)
        {
            var target = obj as UserAddress;
            if (target != null)
            {
                return (Name == target.Name && Country == target.Country && AreaId == target.AreaId &&
                        Address == target.Address && PostalCode == target.PostalCode &&
                        Phone == target.Phone && Mobile == target.Mobile);
            }
            return false;
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
    }
}
